const jsonServer = require('json-server')
const server = jsonServer.create()
const apiRouter = jsonServer.router('db.json') //此处的db.json是与package.json在同一目录下
const middlewares = jsonServer.defaults()
server.get('/egis-scms-app/app/queryWechatToken.dox', (res, req, next) => {
    let getToken = {
        "cacheValue": "Y",
        "returnFlag": "200",
        "returnMsg": "",
        "status": "00"
    }
    req.jsonp(getToken);
})
server.post('/egis-scms-app/app/cache/getRedisCache.dox', (res, req, next) => {
    let resData = {
        "cacheValue": "Y",
        "returnFlag": "200",
        "returnMsg": "",
        "status": "00"
    }
    req.jsonp(resData);
})

server.use(middlewares)
server.use(apiRouter)
server.listen(3000, () => {                 //监听端口
    console.log('JSON Server is running')
})
